<?php 


/**
Tùy biến các thông tin đặt hàng và giao hàng khi thanh toán
*/

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_1' );

// Our hooked in function – $fields is passed via the filter!
function custom_override_checkout_fields_1( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_phone']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_email']);

return $fields;
}


 add_filter( 'woocommerce_checkout_fields' , 'checkout_fields_billing_first_name' );
// Our hooked in function - $fields is passed via the filter!
function checkout_fields_billing_first_name( $fields ) {
    $fields['billing']['billing_first_name'] = array(
        'label'         => __('First Name', 'woocommerce'),
        //'placeholder'   => _x('First Name', 'placeholder', 'woocommerce'),
        'required'      => true,
        'class'         => array('form-row-first'),
    );
 
     return $fields;
}


 add_filter( 'woocommerce_checkout_fields' , 'checkout_fields_billing_last_name' );
// Our hooked in function - $fields is passed via the filter!
function checkout_fields_billing_last_name( $fields ) {
    $fields['billing']['billing_last_name'] = array(
        'label'         => __('Last Name', 'woocommerce'),
        //'placeholder'   => _x('Last Name', 'placeholder', 'woocommerce'),
        'required'      => true,
        'class'         => array('form-row-last'),
        'clear'         => true
    );
 
     return $fields;
}



 add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_billing_phone' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields_billing_phone( $fields ) {
    $fields['billing']['billing_phone'] = array(
    'label'         => __('Phone', 'woocommerce'),
    //'placeholder'   => _x('Phone', 'placeholder', 'woocommerce'),
    'required'      => true,
    'class'         => array('form-row-first')

    );
 
     return $fields;
}

 add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_billing_email' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields_billing_email( $fields ) {
    $fields['billing']['billing_email'] = array(
        'label'         => __('Email Address', 'woocommerce'),
        //'placeholder'   => _x('Email Address', 'placeholder', 'woocommerce'),
        'required'      => true,
        'class'         => array('form-row-last'),
        'clear'         => true
     );
 
     return $fields;
}


add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_billing_adress_1' );
 
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields_billing_adress_1( $fields ) {
     $fields['billing']['billing_address_1'] = array(
    'label'         => __('Address', 'woocommerce'),
    //'placeholder'   => _x('Address', 'placeholder', 'woocommerce'),
    'required'      => true,
    'class'         => array('form-row'),
     );
 
     return $fields;
}




 add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_billing_adress_2' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields_billing_adress_2( $fields ) {
     $fields['billing']['billing_address_2'] = array(
    'label'         => __('Quận/Huyện', 'woocommerce'),
    //'placeholder'   => _x('Quận/Huyện ', 'placeholder', 'woocommerce'),
    'required'      => true,
    'class'         => array('form-row-first'),
     );
 
     return $fields;
}

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_billing_city' );
 
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields_billing_city( $fields ) {
     $fields['billing']['billing_city'] = array(
    'label'         => __('Town/City', 'woocommerce'),
    //'placeholder'   => _x('Town/City', 'placeholder', 'woocommerce'),
    'required'      => true,
    'class'         => array('form-row-last'),
    'clear'         => true
    );
     return $fields;
}

/**
Tùy biến các thông tin người nhận
*/

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_shipping' );

// Our hooked in function – $fields is passed via the filter!
function custom_override_checkout_fields_shipping( $fields ) {
unset($fields['shipping']['shipping_company']);
unset($fields['shipping']['shipping_address_1']);
unset($fields['shipping']['shipping_address_2']);
unset($fields['shipping']['shipping_city']);
unset($fields['shipping']['shipping_country']);
unset($fields['shipping']['shipping_state']);
unset($fields['shipping']['shipping_postcode']);

return $fields;
}


 add_filter( 'woocommerce_checkout_fields' , 'checkout_fields_shipping_first_name' );
// Our hooked in function - $fields is passed via the filter!
function checkout_fields_shipping_first_name( $fields ) {
    $fields['shipping']['shipping_first_name'] = array(
        'label'         => __('First Name', 'woocommerce'),
        //'placeholder'   => _x('First Name', 'placeholder', 'woocommerce'),
        'required'      => true,
        'class'         => array('form-row-first'),
    );
 
     return $fields;
}


 add_filter( 'woocommerce_checkout_fields' , 'checkout_fields_shipping_last_name' );
// Our hooked in function - $fields is passed via the filter!
function checkout_fields_shipping_last_name( $fields ) {
    $fields['shipping']['shipping_last_name'] = array(
        'label'         => __('Last Name', 'woocommerce'),
        //'placeholder'   => _x('Last Name', 'placeholder', 'woocommerce'),
        'required'      => true,
        'class'         => array('form-row-last'),
        'clear'         => true
    );
 
     return $fields;
}



 add_action( 'woocommerce_checkout_fields' , 'checkout_fields_shipping_phone' );
// Our hooked in function - $fields is passed via the filter!
function checkout_fields_shipping_phone( $fields ) {
    $fields['shipping']['shipping_company'] = array(
	'type'			=> 'text',
    'label'         => __('Điện thoại', 'woocommerce'),
    //'placeholder'   => _x('Điện thoại', 'placeholder', 'woocommerce'),
    'required'      => true,
    'class'         => array('form-row-first'),
    'clear'         => true
    );
 
     return $fields;
}


add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_shipping_adress_1' );
 
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields_shipping_adress_1( $fields ) {
     $fields['shipping']['shipping_address_1'] = array(
    'label'         => __('Address', 'woocommerce'),
    //'placeholder'   => _x('Address', 'placeholder', 'woocommerce'),
    'required'      => true,
    'class'         => array('form-row')

     );
 
     return $fields;
}




 add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_shipping_adress_2' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields_shipping_adress_2( $fields ) {
     $fields['shipping']['shipping_address_2'] = array(
    'label'         => __('Quận/Huyện', 'woocommerce'),
    //'placeholder'   => _x('Quận/Huyện ', 'placeholder', 'woocommerce'),
    'required'      => true,
    'class'         => array('form-row-first'),
     );
 
     return $fields;
}

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_shipping_city' );
 
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields_shipping_city( $fields ) {
     $fields['shipping']['shipping_city'] = array(
    'label'         => __('Town/City', 'woocommerce'),
    //'placeholder'   => _x('Town/City', 'placeholder', 'woocommerce'),
    'required'      => true,
    'class'         => array('form-row-last'),
    'clear'         => true
    );
     return $fields;
}

/**
Tùy biến các thông tin người nhận // Trong order
*/


?>